{% extends 'base.html' %}
{% load static %}

{% block title %}
    学生状态详情
{% endblock %}

{% block content %}
<div class="container mt-4">
    <h2 class="mb-4">学生状态详情</h2>
    <div class="mb-4">
        <span>{{ class_info.grade }} {{ class_info.name }}班</span>
        <span>日期: {{ selected_date|date:"Y年m月d日" }}</span>
        <span>星期: {% with day=weekday %}{% if day == 'Monday' %}星期一{% elif day == 'Tuesday' %}星期二{% elif day == 'Wednesday' %}星期三{% elif day == 'Thursday' %}星期四{% elif day == 'Friday' %}星期五{% elif day == 'Saturday' %}星期六{% elif day == 'Sunday' %}星期日{% endif %}{% endwith %}</span>
    </div>
    <div class="card mb-4">
        <div class="card-header bg-primary text-white">
            迟到记录 (共 {{ total_late_count }} 次)
        </div>
        <div class="card-body">
            <h5 class="card-title">上午迟到</h5>
            <ul class="list-group">
                {% for student in late_morning %}
                <li class="list-group-item">{{ student }}</li>
                {% empty %}
                <li class="list-group-item">无迟到记录</li>
                {% endfor %}
            </ul>
            
            <h5 class="card-title mt-3">下午迟到</h5>
            <ul class="list-group">
                {% for student in late_afternoon %}
                <li class="list-group-item">{{ student }}</li>
                {% empty %}
                <li class="list-group-item">无迟到记录</li>
                {% endfor %}
            </ul>
            
            <h5 class="card-title mt-3">晚上迟到</h5>
            <ul class="list-group">
                {% for student in late_evening %}
                <li class="list-group-item">{{ student }}</li>
                {% empty %}
                <li class="list-group-item">无迟到记录</li>
                {% endfor %}
            </ul>
        </div>
    </div>
    
    <div class="card mb-4">
        <div class="card-header bg-success text-white">
            请假记录
        </div>
        <div class="card-body">
            <ul class="list-group">
                {% for student in leave_students %}
                <li class="list-group-item">{{ student }}</li>
                {% empty %}
                <li class="list-group-item">无请假记录</li>
                {% endfor %}
            </ul>
        </div>
    </div>
    
    <div class="card mb-4">
        <div class="card-header bg-danger text-white">
            违纪记录
        </div>
        <div class="card-body">
            <ul class="list-group">
                {% for student in discipline_students %}
                <li class="list-group-item">{{ student }}</li>
                {% empty %}
                <li class="list-group-item">无违纪记录</li>
                {% endfor %}
            </ul>
        </div>
    </div>
    
    <div class="card">
        <div class="card-header bg-warning text-dark">
            预警学生
        </div>
        <div class="card-body">
            <ul class="list-group">
                {% for student in warning_students %}
                <li class="list-group-item">{{ student }}</li>
                {% empty %}
                <li class="list-group-item">无预警学生</li>
                {% endfor %}
            </ul>
        </div>
    </div>
</div>
{% endblock %}